home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / dev / gui / gengui2.lha / GenGui2 / lib / gengui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-16  |  5.5 KB  |  193 lines

  1.  
  2. #ifndef _GENGUI_LNK_H
  3. #define _GENGUI_LNK_H
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #include <exec/types.h>
  10. #include <libraries/gadtools.h>
  11. #include <proto/gadtools.h>
  12. #include <intuition/gadgetclass.h>
  13.  
  14. #define GG_VBOX -1
  15. #define GG_HBOX -2
  16. #define GG_CUSTOM_KIND -3
  17. #define GG_PLAINTEXT_KIND -4
  18. #define GG_GFXBUTTON_KIND -5
  19.  
  20. #define GG_MODE_NEW     0
  21. #define GG_MODE_RESIZE  1
  22. #define GG_MODE_REFRESH 2
  23. #define GG_MODE_STOP    3
  24. #define GG_MODE_FREE    4
  25. #define GG_MODE_BACKUP  5
  26. #define GG_MODE_RESTORE 6
  27.  
  28. #define GG_FLAG_CUSTOM              1
  29. #define GG_FLAG_STRING              2
  30. #define GG_FLAG_INTEGER             4
  31. #define GG_FLAG_DISABLED            8
  32. #define GG_FLAG_RAISED             16
  33. #define GG_FLAG_RECESSED           32
  34. #define GG_FLAG_BAR                64
  35. #define GG_FLAG_DEFAULT_HEIGHT (1<<11)
  36. #define GG_FLAG_DEFAULT_WIDTH  (1<<12)
  37. #define GG_FLAG_BACKUP         (1<<13)
  38. #define GG_FLAG_SKIPREFRESH    (1<<14)
  39. #define GG_FLAG_INITED         (1<<15)
  40.  
  41. #define GG_Left            0
  42. #define GG_Top             0
  43. #define GG_Right       (1<<0)
  44. #define GG_Bottom      (1<<1)
  45. #define GG_HCentered   (1<<2)
  46. #define GG_VCentered   (1<<3)
  47. #define GG_FullSize    (1<<4)
  48. #define GG_NoHighlight (1<<5)
  49.  
  50. #define GG_FLAG_TRADEMASK (GG_FLAG_CUSTOM|GG_FLAG_STRING|GG_FLAG_INTEGER)
  51.  
  52. #define GetString(g)   (((struct StringInfo * )g->SpecialInfo)->Buffer)
  53. #define GetNumber(g)   (((struct StringInfo * )g->SpecialInfo)->LongInt)
  54. #define GetInfo(g)     ((struct GadInfo *)((g)->UserData))
  55. #define GetUserData(g) (GetInfo(g)->UserData)
  56. #define GetGadget(msg) ((struct Gadget *)msg->IAddress)
  57.  
  58. struct GadDim {
  59.    int Kind;
  60.    USHORT Rx,Ry,Cx,Cy,Px,Py;
  61.    USHORT MinCx,MinCy,MinPx,MinPy;
  62.    USHORT SRx,SRy,SPx,SPy; /* Fields for sums of Rx,Ry .... */
  63.    USHORT XSpace,YSpace;
  64.    USHORT Flags;
  65. };
  66.  
  67. struct Box {
  68.    struct GadDim Dim;
  69.    struct Hook *Backfill;
  70.    struct Box **Entry;
  71. };
  72.  
  73. struct WinInfo {
  74.    struct Box *Box;
  75.    struct Gadget **Gadgets;
  76.    struct Gadget *Prev;
  77.    struct Window *Window;
  78.    struct Gadget *GList;
  79.    int FontX,FontY;
  80.    struct TextAttr TextAttr;
  81.    APTR Visual;
  82.    char Mode,Render;
  83. };
  84.  
  85. struct GadInfo {
  86.    struct GadDim Dim;
  87.    int GadNum;
  88.  
  89.    int __stdargs (*CustomFunc)(struct WinInfo *WInfo,
  90.                      struct NewGadget *NewGad,
  91.                      struct GadInfo *GadInfo,
  92.                      int Left, int Top, int Width, int Height);
  93.  
  94.    struct TextAttr *TextAttr;
  95.    char *Text;
  96.    int GadgetID;
  97.    ULONG Flags,UserData;
  98.    int __stdargs (*HookFunc)(struct IntuiMessage *);
  99.    ULONG *Tags;
  100.    ULONG *SaveTags;
  101.    ULONG Code;
  102.    struct Gadget *ThisGad;
  103. };
  104.  
  105. struct GG_ObjectSize {
  106.    int Width,Height;
  107. };
  108.  
  109. void GG_GfxPrintSize(struct RastPort *rast,char *text,struct GG_ObjectSize *size);
  110. void GG_GfxPrint(struct RastPort *rast,char *text,int left,int top);
  111. int  GG_RenderGui(struct Window *win, struct WinInfo *winfo);
  112. int  GG_SmartRenderGui(struct Window *win, struct WinInfo *winfo,struct TextFont **);
  113. int  GG_ResizeGui(struct WinInfo *winfo);
  114. int  GG_RefreshGui(struct WinInfo *winfo);
  115. void GG_FreeGui(struct WinInfo *winfo);
  116. void GG_StopGui(struct WinInfo *winfo);
  117. int  GG_SubGui(struct WinInfo *, struct WinInfo *,int ,int ,int , int );
  118. void GG_ClearWindow(struct Window *);
  119. struct IntuiMessage *GG_GetIMsg(struct MsgPort *userport);
  120. BOOL GG_SetGadgetAttrs(struct Gadget *,struct Window *,struct Requester *, ULONG ,...);
  121. BOOL GG_SetGadgetAttrsA(struct Gadget *,struct Window *,struct Requester *, ULONG *);
  122. void GG_MinSize(struct Window *, struct WinInfo *,struct GG_ObjectSize *);
  123. void GG_MinSizeFont(struct TextFont *, struct WinInfo *,struct GG_ObjectSize *);
  124. BOOL GG_SetLowlevelAttrsA(struct GadInfo *gad, ULONG *Tag);
  125. BOOL GG_SetLowlevelAttrs(struct GadInfo *gad, ULONG Tag1,...);
  126. void GG_BeginResizeGui(struct WinInfo *winfo);
  127.  
  128.  
  129. #define GG_ReplyIMsg(s) GT_ReplyIMsg(s);
  130.  
  131. #ifdef GG_OLDSTYLE
  132.  
  133. #define RenderGui             GG_RenderGui
  134. #define ResizeGui             GG_ResizeGui
  135. #define RefreshGui            GG_RefreshGui
  136. #define FreeGui               GG_FreeGui
  137. #define StopGui               GG_StopGui
  138. #define SubGui                GG_SubGui
  139. #define ClearWindow           GG_ClearWindow
  140. #define Gui_SetGadgetAttrs    GG_SetGadgetAttrs
  141. #define Gui_SetGadgetAttrsA   GG_SetGadgetAttrsA
  142.  
  143. static struct IntuiMessage *Gui_GetIMsg(struct MsgPort *port,struct IntuiMessage *msg)
  144. {
  145.    struct IntuiMessage *m;
  146.  
  147.    if(m=GG_GetIMsg(port)) {
  148.       *msg=*m;
  149.       GG_ReplyIMsg(m);
  150.       return msg;
  151.    }
  152.  
  153.    return NULL;
  154. }
  155.  
  156. #define MODE_NEW       GG_MODE_NEW
  157. #define MODE_RESIZE    GG_MODE_RESIZE
  158. #define MODE_REFRESH   GG_MODE_REFRESH
  159. #define MODE_STOP      GG_MODE_STOP
  160. #define MODE_FREE      GG_MODE_FREE
  161. #define MODE_BACKUP    GG_MODE_BACKUP
  162. #define MODE_RESTORE   GG_MODE_RESTORE
  163.  
  164. #define BOXFLG_CUSTOM         GG_FLAG_CUSTOM
  165. #define BOXFLG_STRING         GG_FLAG_STRING
  166. #define BOXFLG_INTEGER        GG_FLAG_INTEGER
  167. #define BOXFLG_DISABLED       GG_FLAG_DISABLED
  168. #define BOXFLG_RAISED         GG_FLAG_RAISED
  169. #define BOXFLG_RECESSED       GG_FLAG_RECESSED
  170. #define BOXFLG_BAR            GG_FLAG_BAR
  171. #define BOXFLG_BACKUP         GG_FLAG_BACKUP
  172. #define BOXFLG_INITED         GG_FLAG_INITED
  173. #define BOXFLG_SKIPREFRESH    GG_FLAG_SKIPREFRESH
  174. #define BOXFLG_DEFAULT_WIDTH  GG_FLAG_DEFAULT_WIDTH
  175. #define BOXFLG_DEFAULT_HEIGHT GG_FLAG_DEFAULT_HEIGHT
  176. #define BOXFLG_TRADEMASK      GG_FLAG_TRADEMASK
  177.  
  178. #define GL_VBOX            GG_GL_VBOX
  179. #define GL_HBOX            GG_GL_HBOX
  180. #define CUSTOM_KIND        GG_CUSTOM_KIND
  181. #define PLAINTEXT_KIND     GG_PLAINTEXT_KIND
  182. #define GFXBUTTON_KIND     GG_GFXBUTTON_KIND
  183.  
  184. #endif
  185.  
  186.  
  187.  
  188. #ifdef __cplusplus
  189. }
  190. #endif
  191. #endif
  192.  
  193.